<template>
  <div class="bigbanner">
    <el-carousel :height="bheight">
      <el-carousel-item v-for="(item, index) in imgarray" :key="index">
        <img class="bannerimg" :src="item.tuPianDiZhi" @click="topage" :data-type="item.lianJieLeiBie" :data-id="item.id" :data-url="item.lianJieDiZhi"/>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script>
export default {
  props: {
    bheight: {
      type: String,
      default: '300px'
    },
    imgarray:{
      type: Array,
      default:()=>[],
    }
  },
  data() {
    return {
    };
  },
  created:function () {//创建实例之后获取

  },
  methods:{
    //跳转页面
    topage:function(e){
      var that = this;
      var type = e.currentTarget.dataset.type;
      var id = e.currentTarget.dataset.id;
      var url = e.currentTarget.dataset.url;
      //相对路径
      if(type == 1){
        this.$router.push(url)
      }
      //完整路径
      if(type == 2){
        window.open(url,'_blank')
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.bigbanner{
  width: 100%;
  background: #FFF;
  .bannerimg{
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
  }
}
</style>